try:
    a = float(input('请输入被除数:'))
    b = float(input('请输入除数:'))
    c = a/b
    print('商为:',c)
except ZeroDivisionError:
    print('!出书不能为0')
except ValueError:
    print('被除数和除数应为数字类型!')

fileName = 'birthday.txt'
try:
    file = open(fileName,'r')
except FileNotFoundError:
    print(fileName,'文件不存在')
else:
    print(fileName,'文件有',len(file.readlines()),'行')
    file.close()

fileName= 'integer.txt'
try:
   file = open(fileName,'a')
   data = int(input('请输入一个整数:'))
   file.write(str(data))
except Exception as e:
    print(e)
finally:
    print('关闭文件')
    file.close()